//============================================================================
// Name        : Collection.cpp
// Author      : bycy
// Version     : 1.0
// Description : 
//============================================================================

#include "iostream"
#include "List.h"
#include "ListItr.h"

using namespace std;

template < class Type >
class Collection{

public:

	/* 
	* Initialize a collection
	* 
	* REQUIRE:
	*	
	* RETURN:	
	*
	* NOTES:	
	*/
	
	Collection():x(),c(x){

	}

	/* 
	* Deconstruct a collection
	* 
	* REQUIRE:
	*	
	* RETURN:	
	*
	* NOTES:	
	*/

	~Collection(){
	
		delete(x);
		delete(c);

	}

	/* 
	* Insert an elment into this Collection
	* 
	* REQUIRE:	x NOT NULL
	*	
	* RETURN:	
	*
	* NOTES:	
	*/

	void Insert(const Type & x){
		
		ListNode< Type > *current = c->head->Next;
		ListNode< Type > *last = c->head;
		while(current){
		
			if(x < current->data){
			
				last->Next = new ListNode< Type >(x,current);
				return;

			}

		}
		last->Next = new ListNode< Type >(x);
		return;

	};

	/* 
	* Remove an elment from this Collection
	* 
	* REQUIRE:	x NOT NULL
	*	
	* RETURN:	index if this Collection contains x
	*		-1 if this Collection does not contain x
	*
	* NOTES:	
	*/

	int Remove(const Type & x){
	
		return c->Remove(x);

	}

	void Print(){

		ListNode< Type > *current = c->head->Next;
		while(current){

			cout << current->data << "  ";
			current = current->Next;

		}
		cout << endl;

	}





private:

	List< Type > *x;
	ListItr< Type > *c;

};

int main(){

	List<int> x;
	ListItr<int> c(x);
	c.Insert(3);
	c.Insert(4);
	
}